package 并发编程04.ThreadLocal关键字;

/**
 * 作者：idea
 * 日期：2018/8/4
 * 描述：
 */
public class ThreadLocalTest extends Thread{
    private ThreadLocal<String> threadLocal=new ThreadLocal<>();

    @Override
    public void run() {
        threadLocal.set(Thread.currentThread().getName());
        System.out.println("current thread"+Thread.currentThread().getName()+threadLocal.get());
    }

    public static void main(String[] args) {
        ThreadLocalTest t1=new ThreadLocalTest();
        ThreadLocalTest t2=new ThreadLocalTest();
        t1.start();
        t2.start();
    }
}
